﻿#ifndef _CMAP_H_
#define _CMAP_H_
#include "CList.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef int(*CMAP_KEY_COMPARE_FUNC)(void* k1, void* k2);

typedef struct _map_peer_ {
	void* key;
	void* value;
} CMAP_PEER;

typedef struct _cmap_ {
	//value
	CList list;
	CMAP_KEY_COMPARE_FUNC cmp_fn;

	//action
	int(*insert)(struct _cmap_* thes, void* key, void* value);
	void* (*find)(struct _cmap_* thes, void* key);
	int(*release)(struct _cmap_* thes);
} CMap;

int construct_map(CMap* thes, CMAP_KEY_COMPARE_FUNC comp_fn);

#ifdef __cplusplus
}
#endif
#endif
